package com.yan.annotation;

/**
 * Created by yanl_ on 2017/11/24.
 */
public class ResponseResult {

    private int status;
    private String message;
    private Object content;
    private static final ThreadLocal<ResponseResult> result = new ThreadLocal();

    public ResponseResult(int status, String message, Object content) {
        this.status = status;
        this.message = message;
        this.content = content;
    }

    public ResponseResult(int status, String message) {
        this.message = message;
        this.status = status;
    }

    public ResponseResult() {
    }


    public static ResponseResult getResult() {

        return result.get();
    }


    public static ThreadLocal<ResponseResult> setResult(ResponseResult responseResult) {
        result.set(responseResult);
        return result;
    }

    public static  void remove(){

        if(null!=getResult()){
            result.remove();
        }

    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getContent() {
        return content;
    }

    public void setContent(Object content) {
        this.content = content;
    }
}
